<#assign path = request.getContextPath()>
<#assign basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/">

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html >
<head >
<title>WebDesign Login</title>

<meta name="viewport" content="width=device-width, initial-scale=1.0" />

<!-- bootstrap -->
<link href="${path}/css/bootstrap/bootstrap.css" rel="stylesheet" />
<link href="${path}/css/bootstrap/bootstrap-responsive.css" rel="stylesheet" />
<link href="${path}/css/bootstrap/bootstrap-overrides.css" type="text/css" rel="stylesheet" />

<!-- global styles -->
<link rel="stylesheet" type="text/css" href="${path}/css/layout.css" />
<link rel="stylesheet" type="text/css" href="${path}/css/elements.css" />
<link rel="stylesheet" type="text/css" href="${path}/css/icons.css" />

<!-- libraries -->
<link rel="stylesheet" type="text/css" href="${path}/css/lib/font-awesome.css" />

<!-- this page specific styles -->
<link rel="stylesheet" href="${path}/css/compiled/login.css" type="text/css" media="screen" /> 

<!--[if lt IE 9]>
      <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />

</head>
<body class="login-bg">
	<div class="row-fluid login-wrapper">
		<a href="login.jsp"> <img class="logo"
			src="${path}/img/logo-login.png" />
		</a>

		<div class="span4 box">
			<div class="content-wrap">
				<h6>Log in</h6>
				<form action="#" method="post">
					<input class="span12" name="username" id="username" type="text" placeholder="请输入用户名" required autofocus /> 
					<input class="span12" name="password" id="password" type="password"  placeholder="请输入密码" required />
					<p class="loginerror mes" id="message" style="display:none;">登录名或密码错误 请重新登录</p>
					<input type="button" onclick="login();" value="登录" class="btn-glow primary login" style="margin-left:0px" />
				</form>
			</div>
		</div>
	</div>
</body>

	
<!-- scripts -->
<script src="${path}/js/jquery-latest.js"></script>
	
<script type="text/javascript">
function login(){
	$("#message").hide();
	var password = document.getElementById("password").value;
	var username = document.getElementById("username").value;
	$.ajax({
		url : "${path}/acommon/userLogin",
		data: {password:password, username:username},
		type : "post",
		dataType : "json",
		error : function() {
			$('#SecondList').append('请求出错！');
		},
		success : function(responseResult) {
			if(responseResult.flag == "wrong"){
				$("#message").show();
			}else if(responseResult.flag == "admin"){
				document.location.href="${path}/admin/showTeachers";
			}
			else if(responseResult.flag == "teacher"){
				document.location.href="${path}/teacher/showTerms";
			}else if(responseResult.flag == "student"){
				document.location.href="${path}/stu/homeworkState";
			}
		}
	});
}
</script>
</html>